package view;


import javax.swing.JOptionPane;

import controller.ChessController;

/**
 * The playerGUI is the controller working with the user to obtain the current piece that the user would like to move and 
 * the future value, where the player would like to move the piece.
 * 
 * @author Nicole Waldrum
 * @date February 20, 2010
 * @version 2.0
 * 
 * @author Mark Kelly
 * @date February 23, 2010
 * @version 2.0
 *
 */
public class PlayerGUI {
	private String current;
	private String move;

	/**
	 * Creates a JOptionPane to get the necessary data from the user. 
	 */
	public PlayerGUI(ChessController player){
		current = null;
		move = null;

		current = (String)JOptionPane.showInputDialog(null, "Piece Location");
		move = (String)JOptionPane.showInputDialog(null, "New Position");

		if (!player.parseMove(current, move)) {
			showError(current + " " + move);
		}
	}

	/**
	 * If there is an error, complains
	 */
	public void showError(String str){
		JOptionPane.showMessageDialog(null, "Invalid input: " + str, "error", JOptionPane.ERROR_MESSAGE);
	}
	
	
}
